/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: jingziyou
 * Date: 2023-04-10
 * Time: 15:58
 */

import java.util.Scanner;

public class CylinderTest {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("请输入圆柱的半径：");
        double radius = input.nextDouble();

        System.out.print("请输入圆柱的高：");
        double height = input.nextDouble();

        Cylinder cylinder = new Cylinder();
        cylinder.setRadius(radius);
        cylinder.setLength(height);

        System.out.println("圆柱的体积为：" + cylinder.findVolume());
    }
}
class Cylinder extends Circle{
    private double length;
    public Cylinder() {
        length = 1;
    }
    public void setLength(double length) {
        this.length = length;
    }
    public double getLength() {
        return length;
    }
    public double findVolume() {
        return this.findArea() * length;
    }
}
class Circle {
    private double radius;
    public Circle() {
        radius = 1;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }
    public double getRadius() {
        return radius;
    }
    public double findArea() {
        return Math.PI * radius * radius;
    }
}
